export default function (permissionsCaches) {
  return {
    inserted(el, { value }, vnode) {
      if (!permissionsCaches.permissions.has(value)) {
        el.parentNode && el.parentNode.removeChild(el)
        delete vnode.context.$refs[vnode.data.ref]
      }
    },
  }
}
